﻿/*****************************************************************//**
 * @file   VAOneXMLAdaptorPhysicalPropertyRibInfo.h
 * @brief  VAOne读写适配器加筋信息
 *
 * @author liuzhiyuan(liuzhiyuan@diso.cn)
 * @date   2024-11-05
 *********************************************************************/
#ifndef VAONEXMLADAPTORPHYSICALPROPERTYRIBINFO_H
#define VAONEXMLADAPTORPHYSICALPROPERTYRIBINFO_H

#include "FITKVAOneXMLIOAPI.h"
#include "FITKAbstractVAOneXMLAdaptor.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"
#include "Tools/Win64/rapidxml/rapidxml.hpp"

namespace IO
{
    /**
     * @brief   VAOne读写适配器加筋信息
     * @author  liuzhiyuan(liuzhiyuan@diso.cn)
     * @date    2024-11-05
     */
    class FITKVAOneXMLIOAPI VAOneXMLAdaptorPhysicalPropertyRibInfo : public FITKAbstractVAOneXMLAdaptor
    {
        FITKCLASS(IO, VAOneXMLAdaptorPhysicalPropertyRibInfo);
    public:

        /**
         * @brief   构造函数
         * @author  liuzhiyuan(liuzhiyuan@diso.cn)
         * @date    2024-11-05
         */
        explicit VAOneXMLAdaptorPhysicalPropertyRibInfo()= default;
        /**
         * @brief   析构函数
         * @author  liuzhiyuan(liuzhiyuan@diso.cn)
         * @date    2024-11-05
         */
        ~VAOneXMLAdaptorPhysicalPropertyRibInfo() = default;
        /**
         * @brief   适配器读数据
         * @return  是否执行成功
         * @author  liuzhiyuan(liuzhiyuan@diso.cn)
         * @date    2024-11-05
         */
        bool adaptR() override;
        /**
         * @brief   适配器写数据
         * @return  是否执行成功
         * @author  liuzhiyuan(liuzhiyuan@diso.cn)
         * @date    2024-11-05
         */
        bool adaptW() override;

        /**
         * @brief   设置左右加筋number
         * @param   number 加筋方向
         * @author  liuzhiyuan(liuzhiyuan@diso.cn)
         * @date    2024-11-05
         */
        void setAxisNumber(int number);

    private:
        /**
         * @brief   读取加筋数据
         * @return  是否执行成功
         * @author  liuzhiyuan(liuzhiyuan@diso.cn)
         * @date    2024-11-05
         */
        bool readRibInfo();
        /**
         * @brief   写加筋数据
         * @return  是否执行成功
         * @author  liuzhiyuan(liuzhiyuan@diso.cn)
         * @date    2024-11-05
         */
        bool writeRibbed();
        /**
         * @brief   根据板的名字获取板的id
         * @return  int id
         * @author  liuzhiyuan(liuzhiyuan@diso.cn)
         * @date    2024-11-05
         */
        int getPhysicalPropertyObjectIdByName(QString name);
        /**
         * @brief   根据板的id获取板的名称
         * @param[i] name 名称
         * @return  int id
         * @author  liuzhiyuan(liuzhiyuan@diso.cn)
         * @date    2024-11-05
         */
        QString getPhysicalPropertyObjectNameById(int id);
        /**
         * @brief 加筋方向 1是左加筋 2是右加筋
         * @author liuzhiyuan(liuzhiyuan@diso.cn)
         * @date 2024-10-06
         */
        int _axisNumber {-1};
    };
    Register2FITKIOAdaptorFactory(VAOneXML, Acoustics::FITKPhyscisPropertyRibInfo, VAOneXMLAdaptorPhysicalPropertyRibInfo)
}

#endif // VAONEXMLADAPTORPHYSICALPROPERTYRIBINFO_H
